/********************************************************************************
 * Copyright (c)2016-2020, ShenZhen WanJiaAn Technology CO.,LTD.
 * All Rights Reserved.
 *
 * File Name     : config_management.h
 * Author        : joki.zhu
 * Date          : 2019-10-14
 *
 * Record        :
 * 1.Date        : 2019-10-14
 *   Author      : joki.zhu
 *   Modification: Created file
 ********************************************************************************/

#ifndef __CONFIG_MANAGEMENT_H__
#define __CONFIG_MANAGEMENT_H__

#ifdef __cplusplus
#if __cplusplus
extern "C"{
#endif
#endif /* __cplusplus */

#ifdef  __HuaweiLite__
#define CONFIG_DIR_PATH                 "/config/"
#else
#define CONFIG_DIR_PATH                 ""    
#endif /*  __HuaweiLite__ */
#define TAG_FILE_PATH                  CONFIG_DIR_PATH "tag.bin"
#define TAG_ENV_DEFAULT_VALUE           "senv;[SW];version=B1_CN_IOT_V1.11;packtime=0;loglevel=3;init_vw=640;init_vh=360;timezone=;pirstat=1;playvol=100;[FAC];UUID=1;ALEXAID=;[WIFI];SSID=;PASS=;ENCRY=wpa+wpa2;eenv;"
#define TAG_BOARDINFO_DEFAULT_VALUE     "sboard;[PRODUCT];MODLE=B1;CHIP=HI3518EV300;HWVER=B1-MAIN-V10;CLIENT=CN;[DRIVER];SENSORTYPE=PS5260;WIFITYPE=HI1131;BOOLAUDIO=1;BOOLMOTOR=1;BOOLUVC=1;BOOL4G=1;eboard"
#define TAG_USER0_DEFAULT_VALUE         "{}"

/***************************** env segment ********************************/
#define ENV_SEGMENT_FILE_PATH			CONFIG_DIR_PATH"env.config"
#define ENV_SEGMENT_START_FLAG			"senv;"
#define ENV_SEGMENT_END_FLAG			"eenv"

#define ENV_SOFTWARE_TOKEN				"SW"
#define ENV_SOFTWARE_KEY_VERSION		"version"
#define ENV_SOFTWARE_KEY_PACKTIME       "packtime"
#define ENV_SOFTWARE_KEY_LOGLEVEL       "loglevel"
#define ENV_SOFTWARE_KEY_VIDEO_WIDHT	"init_vw"
#define ENV_SOFTWARE_KEY_VIDEO_HEIGHT	"init_vh"
#define ENV_SOFTWARE_KEY_TIMEZONE       "timezone"
#define ENV_SOFTWARE_KEY_PIRSTAT        "pirstat"
#define ENV_SOFTWARE_KEY_PLAYVOL        "playvol"

#define ENV_FACTORY_TOKEN				"FAC"
#define ENV_FACTORY_KEY_UUID			"UUID"
#define ENV_FACTORY_KEY_ALEXAID         "ALEXAID"

#define ENV_WIFI_TOKEN					"WIFI"
#define ENV_WIFI_KEY_SSID				"SSID"
#define ENV_WIFI_KEY_PASSWORD			"PASS"
#define ENV_WIFI_ENCRYPT                "ENCRY"

/***************************** boardinfo segment ********************************/
#define BOARDINFO_SEGMENT_FILE_PATH			CONFIG_DIR_PATH"boardinfo.config"
#define BOARDINFO_SEGMENT_START_FLAG		"sboard;"
#define BOARDINFO_SEGMENT_END_FLAG			"eboard"

#define BOARDINFO_PRODUCT_TOKEN				"PRODUCT"
#define BOARDINFO_PRODUCT_KEY_MODLE			"MODLE"
#define BOARDINFO_PRODUCT_KEY_CHIP			"CHIP"
#define BOARDINFO_PRODUCT_KEY_HARDVERSION	"HWVER"
#define BOARDINFO_PRODUCT_KEY_CLIENT		"CLIENT"

#define BOARDINFO_DRIVER_TOKEN				"WIFI"
#define BOARDINFO_WIFI_KEY_SENSORTYPE		"SENSORTYPE"
#define BOARDINFO_WIFI_KEY_WIFITYPE			"WIFITYPE"
#define BOARDINFO_WIFI_KEY_BOOLMOTOR		"BOOLMOTOR"
#define BOARDINFO_WIFI_KEY_BOOLUVC			"BOOLUVC"
#define BOARDINFO_WIFI_KEY_BOOL4G			"BOOL4G"

int ConfigInit(void);
int ConfigSave(void);
int ConfigGetEnv(char *token, char *param, char *result);
int ConfigSetEnv(char *token, char *param, char *value);
int ConfigGetBoardInfo(char *token, char *param, char *result);
int ConfigSetBoardInfo(char *token, char *param, char *value);
int cmd_tagset(int argc, const char *argv[]);

#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* __cplusplus */


#endif /* __CONFIG_MANAGEMENT_H__ */
